var items_array = new Array(6);

function itemGet(auth, url, hostid_array) {
	let tmp;
	var json_data = JSON.stringify({
		"jsonrpc": "2.0",
		"method": "item.get",
		"params": {
			"output": "extend",
			"hostids": hostid_array,
			"monitored": "true",
			"sortfield": "name"
		},
		"auth": auth,
		"id": 1
	});
	$.ajax({
		url: url,
		method: 'post',
		async: false,
		dataType: 'json',
		headers: {
			"Content-Type": "application/json"
		},
		data: json_data,
		success: function(data) {
			// console.log(data);
			tmp = data;
			console.log(tmp);
			// alert(data.result.length)
			// 请求成功后的结果放在data里面
		}
	});
	return tmp;
}

function itemGetAll() {
	let hostid_array = new Array();
	for (i in auth_array) {
		for(j in hosts_array[i]){
			hostid_array[j] = hosts_array[i][j].hostid;
		}
		var tmp = itemGet(auth_array[i], url_array[i], hostid_array);
		items_array[i] = tmp.length;
		console.log(items_array[i]);
	}
}

// itemGetAll();
